
use T2Logging;
GO
-- Drop stored procedure if it already exists
IF EXISTS (
  SELECT * 
    FROM INFORMATION_SCHEMA.ROUTINES 
   WHERE SPECIFIC_CATALOG = N'T2Logging' 
	 AND SPECIFIC_SCHEMA = N'dbo'
     AND SPECIFIC_NAME = N'Application_udt' 
)
   DROP PROCEDURE dbo.Application_udt
GO
create procedure dbo.Application_udt
	@ApplicationID Int,
	@ApplicationName NVarChar(100),
	@TS varbinary(8),
	@CreatedBy VarChar(50),
	@CreatedDt DateTime,
	@ModifiedBy VarChar(50),
	@ModifiedDt DateTime,
	@TenantID Int,
	@RowsAffected int = null OUTPUT 
	
--*************************************************************
--Created By: trooks
--Name: dbo_Application_udt
--Table: Application
--Database: T2Logging
--Created Date: 02/15/2013 00:00:00
--*************************************************************

as
    Begin Try
		update [dbo].Application
        Set

		ApplicationName = @ApplicationName, 
		CreatedBy = @CreatedBy, 
		CreatedDt = @CreatedDt, 
		ModifiedBy = @ModifiedBy, 
		ModifiedDt = @ModifiedDt, 
		TenantID = @TenantID 
    where
		 @ApplicationID = ApplicationID
		AND @TS = TS
		Set @RowsAffected = @@ROWCOUNT;
		return 0;	
	END TRY
	BEGIN CATCH
		Set @RowsAffected = 0;
		EXEC dbo.uspLogError;
		return -1;
	END CATCH
	
GO
GRANT EXECUTE ON [T2Logging].[dbo].[Application_udt] to PORTAL_T2Logging
GO













